# coding: utf-8
from abc import abstractmethod
from concurrent.futures import ThreadPoolExecutor

threadPool = ThreadPoolExecutor(max_workers=2, thread_name_prefix="thread_")


class MyThreadPool:
    def __init__(self, name, data):
        self.name = name
        self.data = data

    @abstractmethod
    def execute(self):
        print('ThreadPool实现此方法')

    def run_task(self):
        threadPool.submit(self.execute)
        print('线程提交执行完成')


if __name__ == '__main__':
    class SelectRun(MyThreadPool):
        def execute(self):
            print(str(self.data))
            print('SelectRun实现此方法')


    sr = SelectRun('select', '我要执行此方法')
    sr.run_task()
